<?php 

class BaseStatsReportForm extends BaseReportForm
{


    public function getTemplate(){
        return "stats_compare";
    }

    public function getGroupByFields($key = null){
        $arr  = array(

        'all' => 'All'
        , EmployeePeer::SECTION_ID    => 'Section'
        , EmployeePeer::DEPARTMENT_ID => 'Department'
        , EmployeePeer::ID => 'Employee'
        );
        return $key ? $arr[$key] : $arr;
    }

    public function getModelName(){
        return "LinkEmployeeLeave";
    }
    
    public function configure(){
        parent::configure();

        $this->widgetSchema['group_by']= new sfWidgetFormChoice(
        array(
        'expanded' => true,
        'choices'  => $this->getGroupByFields()));
        $this->validatorSchema['group_by']= new sfValidatorChoice(
        array(
        'choices'  => array_keys($this->getGroupByFields()),'required'=>false
        ));
    }
    public function getCriteria(){
        /*@var $cr Criteria*/
        $cr = parent::getCriteria();
        //$cr->addGroupByColumn(LinkEmployeeLeavePeer::MONTH );
        return $cr;
    }
    
	protected function addDepartmentIdColumnCriteria(Criteria $criteria, $field, $value=null){
		
		if($value){
			$criteria->addJoin(LinkEmployeeLeavePeer::EMPLOYEE_ID  , EmployeePeer::ID  );
			$criteria->add(EmployeePeer::DEPARTMENT_ID , $value );
		}
	}
    
	protected function addSectionIdColumnCriteria(Criteria $criteria, $field, $value=null){
		
		if($value){
			$criteria->addJoin(LinkEmployeeLeavePeer::EMPLOYEE_ID  , EmployeePeer::ID  );
			$criteria->add(EmployeePeer::SECTION_ID  , $value );
		}
	}
    

}
